#!/usr/bin/python
multiples = [];
counter = 0;
sum = 0;
for i in range(1000):
 if i % 3  == 0:
	multiples.append(i); 
	counter += 1 ;
	sum += i;
 elif i % 5 == 0:
 	multiples.append(i);
 	counter += 1;
 	sum += i
#print multiples, sum;
print sum;